package com.sds.emp.services.user.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.sds.emp.services.user.vo.SearchVO;
import com.sds.emp.services.user.vo.UserVO;

@Repository
public class UserDAO {

    public final List<UserVO> getUserList(final SearchVO searchVO)
            throws Exception {
        List<UserVO> result = new ArrayList<UserVO>();

        UserVO userVO = new UserVO();
        userVO.setUserId("admin");
        userVO.setUserName("ADMINISTRATOR");
        userVO.setEmail("anyframe@samsung.com");
        if (!searchVO.getSearchKeyword().equals("")) {
            result.add(userVO);
        }

        return result;
    }

    public final int addUser(final UserVO userVO) throws Exception {
        if (userVO.getUserId().startsWith("user")) {
            return 1;
        } else {
            return 0;
        }
    }

    public final int updateUser(final UserVO userVO) throws Exception {
        if (userVO.getUserName().equals("")) {
            return 0;
        } else {
            return 1;
        }
    }
}
